﻿namespace HRM.CORE
{
    using DevExpress.Utils;
    using DevExpress.XtraBars;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraTab;
    using APP.HELPER;
    using Common.Class; using APP.HELPER.Utils.Language; using Security.Security; using Dictionary.ERP;
    using HRM.CORE.Option;
    
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms; using Common;
    using Common;
    using APP.HELPER.Utils.Net;

    public class xfmAllOption : XtraForm
    {
        private SimpleButton btnClose;
        private SimpleButton btnStart;
        private CalcEdit calPort;
        private CheckEdit cheEnableSSL;
        private CheckEdit cheShowDiagram;
        private CheckEdit cheShowSalary;
        private CheckEdit cheShowSendMail;
        private CheckEdit cheShowTimekeeper;
        private CheckEdit cheShowWelcome;
        private CheckEdit cheShowWorkdesk;
        private IContainer components;
        private DateEdit dtMonthDefault;
        private GroupBox groupBox1;
        private GroupBox groupBox2;
        private GroupBox groupBox3;
        private GroupBox groupBox4;
        private GroupBox groupBox5;
        private GroupBox groupBox6;
        private GroupBox groupBox7;
        private GroupControl groupControl1;
        private DevExpress.Utils.ImageCollection imgClassic;
        private DevExpress.Utils.ImageCollection imgMetro;
        private LabelControl labelControl1;
        private LabelControl labelControl2;
        private LabelControl labelControl3;
        private LabelControl labelControl4;
        private LabelControl labelControl5;
        private LabelControl labelControl6;
        private LabelControl labelControl7;
        private bool m_LoadReportOption;
        private RadioGroup rdUpdate;
        private XtraTabPage tabAllOption;
        private XtraTabPage tabContract;
        private XtraTabPage tabDocumentNumber;
        private XtraTabPage tabMinimumSalary;
        private XtraTabPage tabReport;
        private XtraTabPage tabSalary;
        private XtraTabPage tabSendMail;
        private XtraTabPage tabTimeKeeper;
        private XtraTabPage tabWarning;
        private TextEdit txtHost;
        private XtraTabControl xtraTabOption;
        private HRM.CORE.Option.xucContractOption xucContractOption;
        private HRM.CORE.Option.xucDocumentNumberOption xucDocumentNumberOption;
        private xucFooterReportOption xucFooterReportOption1;
        private xucHeaderReportOption xucHeaderReportOption1;
        private HRM.CORE.xucMinimumSalary xucMinimumSalary;
        private HRM.CORE.xucSalaryFormula xucSalaryFormula;
        private HRM.CORE.Option.xucTimeKeeperOption xucTimeKeeperOption;
        private HRM.CORE.Option.xucWarningOption xucWarningOption;

        public xfmAllOption()
        {
            this.m_LoadReportOption = false;
            this.components = null;
            this.InitializeComponent();
            this.Init();
            this.SetStyle(LoadStyle());
        }

        public xfmAllOption(string TabName)
        {
            this.m_LoadReportOption = false;
            this.components = null;
            this.InitializeComponent();
            this.Init();
            this.SetStyle(LoadStyle());
            if (TabName == "tabSalary")
            {
                this.xtraTabOption.SelectedTabPage = this.tabSalary;
            }
            else if (TabName == "tabMinimumSalary")
            {
                this.xtraTabOption.SelectedTabPage = this.tabMinimumSalary;
            }
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            new clsAllOption { MonthDefault = this.dtMonthDefault.DateTime, ShowDiagram = this.cheShowDiagram.Checked, ShowWorkdesk = this.cheShowWorkdesk.Checked, ShowWelcome = this.cheShowWelcome.Checked, ShowSendMail = this.cheShowSendMail.Checked, ShowTimekeeper = this.cheShowTimekeeper.Checked, ShowSalary = this.cheShowSalary.Checked, Update = this.rdUpdate.SelectedIndex }.SaveOption();
            new clsEmailOption { Host = this.txtHost.Text, Port = Convert.ToInt32(this.calPort.EditValue.ToString()), EnableSSL = this.cheEnableSSL.Checked }.SaveOption();
            if (this.m_LoadReportOption)
            {
                this.xucHeaderReportOption1.Save();
                this.xucFooterReportOption1.Save();
            }
            if (this.xucContractOption != null)
            {
                this.xucContractOption.Save();
            }
            if (this.xucTimeKeeperOption != null)
            {
                this.xucTimeKeeperOption.Save();
            }
            if (this.xucDocumentNumberOption != null)
            {
                this.xucDocumentNumberOption.Save();
            }
            if (this.xucMinimumSalary != null)
            {
                this.xucMinimumSalary.Save();
            }
            if (this.xucSalaryFormula != null)
            {
                this.xucSalaryFormula.Save();
            }
            if (this.xucWarningOption != null)
            {
                this.xucWarningOption.Save();
            }
            base.Close();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Init()
        {
            clsAllOption option = new clsAllOption();
            this.dtMonthDefault.DateTime = option.MonthDefault;
            this.cheShowDiagram.Checked = option.ShowDiagram;
            this.cheShowWorkdesk.Checked = option.ShowWorkdesk;
            this.cheShowWelcome.Checked = option.ShowWelcome;
            this.cheShowSendMail.Checked = option.ShowSendMail;
            this.cheShowTimekeeper.Checked = option.ShowTimekeeper;
            this.cheShowSalary.Checked = option.ShowSalary;
            this.rdUpdate.SelectedIndex = option.Update;
            clsEmailOption option2 = new clsEmailOption();
            this.txtHost.Text = option2.Host;
            this.calPort.EditValue = option2.Port;
            this.cheEnableSSL.Checked = Convert.ToBoolean(option2.EnableSSL.ToString());
        }

        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(xfmAllOption));
            this.cheShowDiagram = new DevExpress.XtraEditors.CheckEdit();
            this.cheShowWorkdesk = new DevExpress.XtraEditors.CheckEdit();
            this.rdUpdate = new DevExpress.XtraEditors.RadioGroup();
            this.groupControl1 = new DevExpress.XtraEditors.GroupControl();
            this.btnClose = new DevExpress.XtraEditors.SimpleButton();
            this.btnStart = new DevExpress.XtraEditors.SimpleButton();
            this.cheShowWelcome = new DevExpress.XtraEditors.CheckEdit();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.xtraTabOption = new DevExpress.XtraTab.XtraTabControl();
            this.imgClassic = new DevExpress.Utils.ImageCollection(this.components);
            this.tabAllOption = new DevExpress.XtraTab.XtraTabPage();
            this.groupBox7 = new System.Windows.Forms.GroupBox();
            this.labelControl7 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl6 = new DevExpress.XtraEditors.LabelControl();
            this.cheShowTimekeeper = new DevExpress.XtraEditors.CheckEdit();
            this.cheShowSalary = new DevExpress.XtraEditors.CheckEdit();
            this.groupBox5 = new System.Windows.Forms.GroupBox();
            this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
            this.dtMonthDefault = new DevExpress.XtraEditors.DateEdit();
            this.tabSendMail = new DevExpress.XtraTab.XtraTabPage();
            this.groupBox6 = new System.Windows.Forms.GroupBox();
            this.labelControl5 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
            this.calPort = new DevExpress.XtraEditors.CalcEdit();
            this.cheEnableSSL = new DevExpress.XtraEditors.CheckEdit();
            this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
            this.txtHost = new DevExpress.XtraEditors.TextEdit();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.cheShowSendMail = new DevExpress.XtraEditors.CheckEdit();
            this.tabContract = new DevExpress.XtraTab.XtraTabPage();
            this.tabTimeKeeper = new DevExpress.XtraTab.XtraTabPage();
            this.tabMinimumSalary = new DevExpress.XtraTab.XtraTabPage();
            this.tabSalary = new DevExpress.XtraTab.XtraTabPage();
            this.tabReport = new DevExpress.XtraTab.XtraTabPage();
            this.groupBox4 = new System.Windows.Forms.GroupBox();
            this.groupBox3 = new System.Windows.Forms.GroupBox();
            this.tabDocumentNumber = new DevExpress.XtraTab.XtraTabPage();
            this.tabWarning = new DevExpress.XtraTab.XtraTabPage();
            this.imgMetro = new DevExpress.Utils.ImageCollection(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.cheShowDiagram.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.cheShowWorkdesk.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.rdUpdate.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.groupControl1)).BeginInit();
            this.groupControl1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.cheShowWelcome.Properties)).BeginInit();
            this.groupBox1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.xtraTabOption)).BeginInit();
            this.xtraTabOption.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.imgClassic)).BeginInit();
            this.tabAllOption.SuspendLayout();
            this.groupBox7.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.cheShowTimekeeper.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.cheShowSalary.Properties)).BeginInit();
            this.groupBox5.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dtMonthDefault.Properties.CalendarTimeProperties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtMonthDefault.Properties)).BeginInit();
            this.tabSendMail.SuspendLayout();
            this.groupBox6.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.calPort.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.cheEnableSSL.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtHost.Properties)).BeginInit();
            this.groupBox2.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.cheShowSendMail.Properties)).BeginInit();
            this.tabReport.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.imgMetro)).BeginInit();
            this.SuspendLayout();
            // 
            // cheShowDiagram
            // 
            this.cheShowDiagram.EditValue = true;
            this.cheShowDiagram.Location = new System.Drawing.Point(11, 26);
            this.cheShowDiagram.Name = "cheShowDiagram";
            this.cheShowDiagram.Properties.Caption = "Hiển thị sơ đồ chức năng khi khởi động chương trình";
            this.cheShowDiagram.Size = new System.Drawing.Size(332, 19);
            this.cheShowDiagram.TabIndex = 2;
            // 
            // cheShowWorkdesk
            // 
            this.cheShowWorkdesk.EditValue = true;
            this.cheShowWorkdesk.Location = new System.Drawing.Point(11, 54);
            this.cheShowWorkdesk.Name = "cheShowWorkdesk";
            this.cheShowWorkdesk.Properties.Caption = "Hiển thị bàn làm việc khi khởi động chương trình";
            this.cheShowWorkdesk.Size = new System.Drawing.Size(332, 19);
            this.cheShowWorkdesk.TabIndex = 3;
            // 
            // rdUpdate
            // 
            this.rdUpdate.EditValue = 0;
            this.rdUpdate.Location = new System.Drawing.Point(12, 25);
            this.rdUpdate.Name = "rdUpdate";
            this.rdUpdate.Properties.Appearance.BackColor = System.Drawing.Color.Transparent;
            this.rdUpdate.Properties.Appearance.Options.UseBackColor = true;
            this.rdUpdate.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
            this.rdUpdate.Properties.Items.AddRange(new DevExpress.XtraEditors.Controls.RadioGroupItem[] {
            new DevExpress.XtraEditors.Controls.RadioGroupItem(0, "Tự động cập nhật khi có phiên bản mới", false),
            new DevExpress.XtraEditors.Controls.RadioGroupItem(0, "Thông báo cho tôi biết khi có bản cập nhật mới"),
            new DevExpress.XtraEditors.Controls.RadioGroupItem(0, "Không cần thông báo cho tôi khi có bản cập nhật mới")});
            this.rdUpdate.Size = new System.Drawing.Size(315, 101);
            this.rdUpdate.TabIndex = 0;
            // 
            // groupControl1
            // 
            this.groupControl1.Controls.Add(this.rdUpdate);
            this.groupControl1.Location = new System.Drawing.Point(19, 216);
            this.groupControl1.Name = "groupControl1";
            this.groupControl1.Size = new System.Drawing.Size(478, 134);
            this.groupControl1.TabIndex = 4;
            this.groupControl1.Text = "Cập nhật phần mềm";
            // 
            // btnClose
            // 
            this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.btnClose.Location = new System.Drawing.Point(594, 535);
            this.btnClose.Name = "btnClose";
            this.btnClose.Size = new System.Drawing.Size(84, 23);
            this.btnClose.TabIndex = 10;
            this.btnClose.Text = "Đóng";
            this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
            // 
            // btnStart
            // 
            this.btnStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.btnStart.Location = new System.Drawing.Point(497, 535);
            this.btnStart.Name = "btnStart";
            this.btnStart.Size = new System.Drawing.Size(85, 23);
            this.btnStart.TabIndex = 9;
            this.btnStart.Text = "Đồng Ý";
            this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
            // 
            // cheShowWelcome
            // 
            this.cheShowWelcome.EditValue = true;
            this.cheShowWelcome.Location = new System.Drawing.Point(11, 82);
            this.cheShowWelcome.Name = "cheShowWelcome";
            this.cheShowWelcome.Properties.Caption = "Hiển thị cửa sổ chào mừng khi khởi động chương trình";
            this.cheShowWelcome.Size = new System.Drawing.Size(332, 19);
            this.cheShowWelcome.TabIndex = 11;
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.cheShowDiagram);
            this.groupBox1.Controls.Add(this.cheShowWelcome);
            this.groupBox1.Controls.Add(this.cheShowWorkdesk);
            this.groupBox1.Location = new System.Drawing.Point(19, 86);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(478, 112);
            this.groupBox1.TabIndex = 13;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Khi khởi động chương trình";
            // 
            // xtraTabOption
            // 
            this.xtraTabOption.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left)));
            this.xtraTabOption.HeaderLocation = DevExpress.XtraTab.TabHeaderLocation.Left;
            this.xtraTabOption.HeaderOrientation = DevExpress.XtraTab.TabOrientation.Horizontal;
            this.xtraTabOption.Images = this.imgClassic;
            this.xtraTabOption.Location = new System.Drawing.Point(7, 4);
            this.xtraTabOption.MultiLine = DevExpress.Utils.DefaultBoolean.True;
            this.xtraTabOption.Name = "xtraTabOption";
            this.xtraTabOption.SelectedTabPage = this.tabAllOption;
            this.xtraTabOption.Size = new System.Drawing.Size(674, 519);
            this.xtraTabOption.TabIndex = 17;
            this.xtraTabOption.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
            this.tabAllOption,
            this.tabSendMail,
            this.tabContract,
            this.tabTimeKeeper,
            this.tabMinimumSalary,
            this.tabSalary,
            this.tabReport,
            this.tabDocumentNumber,
            this.tabWarning});
            this.xtraTabOption.SelectedPageChanged += new DevExpress.XtraTab.TabPageChangedEventHandler(this.xtraTabOption_SelectedPageChanged);
            // 
            // imgClassic
            // 
            this.imgClassic.ImageStream = ((DevExpress.Utils.ImageCollectionStreamer)(resources.GetObject("imgClassic.ImageStream")));
            // 
            // tabAllOption
            // 
            this.tabAllOption.Controls.Add(this.groupBox7);
            this.tabAllOption.Controls.Add(this.groupBox5);
            this.tabAllOption.Controls.Add(this.groupBox1);
            this.tabAllOption.Controls.Add(this.groupControl1);
            this.tabAllOption.ImageIndex = 0;
            this.tabAllOption.Name = "tabAllOption";
            this.tabAllOption.Size = new System.Drawing.Size(553, 513);
            this.tabAllOption.Text = "Tùy Chọn Chung";
            // 
            // groupBox7
            // 
            this.groupBox7.Controls.Add(this.labelControl7);
            this.groupBox7.Controls.Add(this.labelControl6);
            this.groupBox7.Controls.Add(this.cheShowTimekeeper);
            this.groupBox7.Controls.Add(this.cheShowSalary);
            this.groupBox7.Location = new System.Drawing.Point(19, 363);
            this.groupBox7.Name = "groupBox7";
            this.groupBox7.Size = new System.Drawing.Size(478, 137);
            this.groupBox7.TabIndex = 15;
            this.groupBox7.TabStop = false;
            this.groupBox7.Text = "Hiện/ẩn bớt chức năng của phần mềm";
            // 
            // labelControl7
            // 
            this.labelControl7.AllowHtmlString = true;
            this.labelControl7.Appearance.ForeColor = System.Drawing.Color.DimGray;
            this.labelControl7.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.None;
            this.labelControl7.Location = new System.Drawing.Point(17, 19);
            this.labelControl7.Name = "labelControl7";
            this.labelControl7.Size = new System.Drawing.Size(445, 25);
            this.labelControl7.TabIndex = 14;
            this.labelControl7.Text = "Để giảm bớt tính phần tạp của phần mềm, bạn có thể ẩn bớt các chức năng không cần" +
    " thiết.";
            // 
            // labelControl6
            // 
            this.labelControl6.AllowHtmlString = true;
            this.labelControl6.Appearance.ForeColor = System.Drawing.Color.DimGray;
            this.labelControl6.Location = new System.Drawing.Point(17, 111);
            this.labelControl6.Name = "labelControl6";
            this.labelControl6.Size = new System.Drawing.Size(288, 13);
            this.labelControl6.TabIndex = 14;
            this.labelControl6.Text = "<i>Lưu ý:</i> Bạn cần khởi động lại phần mềm để thấy sự thay đổi.";
            // 
            // cheShowTimekeeper
            // 
            this.cheShowTimekeeper.EditValue = true;
            this.cheShowTimekeeper.Location = new System.Drawing.Point(15, 51);
            this.cheShowTimekeeper.Name = "cheShowTimekeeper";
            this.cheShowTimekeeper.Properties.Caption = "Hiện các chức năng liên quan chấm công trên giao diện chương trình";
            this.cheShowTimekeeper.Size = new System.Drawing.Size(430, 19);
            this.cheShowTimekeeper.TabIndex = 2;
            // 
            // cheShowSalary
            // 
            this.cheShowSalary.EditValue = true;
            this.cheShowSalary.Location = new System.Drawing.Point(15, 77);
            this.cheShowSalary.Name = "cheShowSalary";
            this.cheShowSalary.Properties.Caption = "Hiện các chức năng liên quan tính lương trên giao diện chương trình";
            this.cheShowSalary.Size = new System.Drawing.Size(430, 19);
            this.cheShowSalary.TabIndex = 3;
            // 
            // groupBox5
            // 
            this.groupBox5.Controls.Add(this.labelControl3);
            this.groupBox5.Controls.Add(this.dtMonthDefault);
            this.groupBox5.Location = new System.Drawing.Point(19, 12);
            this.groupBox5.Name = "groupBox5";
            this.groupBox5.Size = new System.Drawing.Size(478, 59);
            this.groupBox5.TabIndex = 14;
            this.groupBox5.TabStop = false;
            this.groupBox5.Text = "Tháng báo cáo";
            // 
            // labelControl3
            // 
            this.labelControl3.Location = new System.Drawing.Point(13, 26);
            this.labelControl3.Name = "labelControl3";
            this.labelControl3.Size = new System.Drawing.Size(118, 13);
            this.labelControl3.TabIndex = 13;
            this.labelControl3.Text = "Tháng phát sinh báo cáo";
            // 
            // dtMonthDefault
            // 
            this.dtMonthDefault.EditValue = null;
            this.dtMonthDefault.Location = new System.Drawing.Point(154, 23);
            this.dtMonthDefault.Name = "dtMonthDefault";
            this.dtMonthDefault.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold);
            this.dtMonthDefault.Properties.Appearance.Options.UseFont = true;
            this.dtMonthDefault.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.dtMonthDefault.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton()});
            this.dtMonthDefault.Properties.DisplayFormat.FormatString = "MM/yyyy";
            this.dtMonthDefault.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
            this.dtMonthDefault.Properties.EditFormat.FormatString = "MM/yyyy";
            this.dtMonthDefault.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
            this.dtMonthDefault.Properties.Mask.EditMask = "MM/yyyy";
            this.dtMonthDefault.Size = new System.Drawing.Size(98, 20);
            this.dtMonthDefault.TabIndex = 2;
            // 
            // tabSendMail
            // 
            this.tabSendMail.Controls.Add(this.groupBox6);
            this.tabSendMail.Controls.Add(this.groupBox2);
            this.tabSendMail.ImageIndex = 1;
            this.tabSendMail.Name = "tabSendMail";
            this.tabSendMail.Size = new System.Drawing.Size(553, 513);
            this.tabSendMail.Text = "Cấu Hình Gửi Mail";
            // 
            // groupBox6
            // 
            this.groupBox6.Controls.Add(this.labelControl5);
            this.groupBox6.Controls.Add(this.labelControl4);
            this.groupBox6.Controls.Add(this.calPort);
            this.groupBox6.Controls.Add(this.cheEnableSSL);
            this.groupBox6.Controls.Add(this.labelControl2);
            this.groupBox6.Controls.Add(this.labelControl1);
            this.groupBox6.Controls.Add(this.txtHost);
            this.groupBox6.Location = new System.Drawing.Point(19, 88);
            this.groupBox6.Name = "groupBox6";
            this.groupBox6.Size = new System.Drawing.Size(478, 126);
            this.groupBox6.TabIndex = 16;
            this.groupBox6.TabStop = false;
            this.groupBox6.Text = "Cấu hình mail";
            // 
            // labelControl5
            // 
            this.labelControl5.Appearance.ForeColor = System.Drawing.Color.DimGray;
            this.labelControl5.Location = new System.Drawing.Point(334, 65);
            this.labelControl5.Name = "labelControl5";
            this.labelControl5.Size = new System.Drawing.Size(60, 13);
            this.labelControl5.TabIndex = 18;
            this.labelControl5.Text = "Ví dụ: 587,..";
            // 
            // labelControl4
            // 
            this.labelControl4.Appearance.ForeColor = System.Drawing.Color.DimGray;
            this.labelControl4.Location = new System.Drawing.Point(334, 33);
            this.labelControl4.Name = "labelControl4";
            this.labelControl4.Size = new System.Drawing.Size(116, 13);
            this.labelControl4.TabIndex = 18;
            this.labelControl4.Text = "Ví dụ: smtp.gmail.com,..";
            // 
            // calPort
            // 
            this.calPort.Location = new System.Drawing.Point(106, 62);
            this.calPort.Name = "calPort";
            this.calPort.Size = new System.Drawing.Size(222, 20);
            this.calPort.TabIndex = 17;
            // 
            // cheEnableSSL
            // 
            this.cheEnableSSL.Location = new System.Drawing.Point(15, 95);
            this.cheEnableSSL.Name = "cheEnableSSL";
            this.cheEnableSSL.Properties.Caption = "Có xác thực SSL";
            this.cheEnableSSL.Size = new System.Drawing.Size(120, 19);
            this.cheEnableSSL.TabIndex = 4;
            // 
            // labelControl2
            // 
            this.labelControl2.Location = new System.Drawing.Point(18, 65);
            this.labelControl2.Name = "labelControl2";
            this.labelControl2.Size = new System.Drawing.Size(25, 13);
            this.labelControl2.TabIndex = 3;
            this.labelControl2.Text = "Cổng";
            // 
            // labelControl1
            // 
            this.labelControl1.Location = new System.Drawing.Point(18, 33);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new System.Drawing.Size(79, 13);
            this.labelControl1.TabIndex = 2;
            this.labelControl1.Text = "Máy chủ gửi mail";
            // 
            // txtHost
            // 
            this.txtHost.Location = new System.Drawing.Point(106, 30);
            this.txtHost.Name = "txtHost";
            this.txtHost.Size = new System.Drawing.Size(222, 20);
            this.txtHost.TabIndex = 0;
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.cheShowSendMail);
            this.groupBox2.Location = new System.Drawing.Point(19, 17);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(478, 54);
            this.groupBox2.TabIndex = 15;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Tùy chọn khi gửi mail trong chương trình";
            // 
            // cheShowSendMail
            // 
            this.cheShowSendMail.EditValue = true;
            this.cheShowSendMail.Location = new System.Drawing.Point(11, 25);
            this.cheShowSendMail.Name = "cheShowSendMail";
            this.cheShowSendMail.Properties.Caption = "Hiển thị hộp thoại cho phép thay đổi nội dung khi gửi mail";
            this.cheShowSendMail.Size = new System.Drawing.Size(332, 19);
            this.cheShowSendMail.TabIndex = 12;
            // 
            // tabContract
            // 
            this.tabContract.ImageIndex = 2;
            this.tabContract.Name = "tabContract";
            this.tabContract.Size = new System.Drawing.Size(553, 513);
            this.tabContract.Text = "Hợp Đồng Lao Động";
            // 
            // tabTimeKeeper
            // 
            this.tabTimeKeeper.ImageIndex = 3;
            this.tabTimeKeeper.Name = "tabTimeKeeper";
            this.tabTimeKeeper.Size = new System.Drawing.Size(553, 513);
            this.tabTimeKeeper.Text = "Chấm Công";
            // 
            // tabMinimumSalary
            // 
            this.tabMinimumSalary.ImageIndex = 8;
            this.tabMinimumSalary.Name = "tabMinimumSalary";
            this.tabMinimumSalary.Size = new System.Drawing.Size(553, 513);
            this.tabMinimumSalary.Text = "Mức Lương Tối Thiểu";
            // 
            // tabSalary
            // 
            this.tabSalary.ImageIndex = 4;
            this.tabSalary.Name = "tabSalary";
            this.tabSalary.Size = new System.Drawing.Size(553, 513);
            this.tabSalary.Text = "Định Mức Tính Lương";
            // 
            // tabReport
            // 
            this.tabReport.AutoScroll = true;
            this.tabReport.Controls.Add(this.groupBox4);
            this.tabReport.Controls.Add(this.groupBox3);
            this.tabReport.ImageIndex = 5;
            this.tabReport.Margin = new System.Windows.Forms.Padding(0);
            this.tabReport.Name = "tabReport";
            this.tabReport.Size = new System.Drawing.Size(553, 513);
            this.tabReport.Text = "In Báo Cáo";
            // 
            // groupBox4
            // 
            this.groupBox4.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold);
            this.groupBox4.ForeColor = System.Drawing.Color.Blue;
            this.groupBox4.Location = new System.Drawing.Point(14, 388);
            this.groupBox4.Name = "groupBox4";
            this.groupBox4.Size = new System.Drawing.Size(472, 18);
            this.groupBox4.TabIndex = 3;
            this.groupBox4.TabStop = false;
            this.groupBox4.Text = "Cuối trang in";
            // 
            // groupBox3
            // 
            this.groupBox3.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold);
            this.groupBox3.ForeColor = System.Drawing.Color.Blue;
            this.groupBox3.Location = new System.Drawing.Point(13, 10);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new System.Drawing.Size(472, 18);
            this.groupBox3.TabIndex = 2;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "Đầu trang in";
            // 
            // tabDocumentNumber
            // 
            this.tabDocumentNumber.ImageIndex = 6;
            this.tabDocumentNumber.Name = "tabDocumentNumber";
            this.tabDocumentNumber.Size = new System.Drawing.Size(553, 513);
            this.tabDocumentNumber.Text = "Số Tăng Tự Động";
            // 
            // tabWarning
            // 
            this.tabWarning.ImageIndex = 7;
            this.tabWarning.Name = "tabWarning";
            this.tabWarning.PageVisible = false;
            this.tabWarning.Size = new System.Drawing.Size(553, 513);
            this.tabWarning.Text = "Cảnh Báo";
            // 
            // imgMetro
            // 
            this.imgMetro.ImageSize = new System.Drawing.Size(32, 32);
            this.imgMetro.ImageStream = ((DevExpress.Utils.ImageCollectionStreamer)(resources.GetObject("imgMetro.ImageStream")));
            // 
            // xfmAllOption
            // 
            this.ClientSize = new System.Drawing.Size(688, 568);
            this.Controls.Add(this.xtraTabOption);
            this.Controls.Add(this.btnClose);
            this.Controls.Add(this.btnStart);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "xfmAllOption";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Tùy chọn";
            ((System.ComponentModel.ISupportInitialize)(this.cheShowDiagram.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.cheShowWorkdesk.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.rdUpdate.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.groupControl1)).EndInit();
            this.groupControl1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.cheShowWelcome.Properties)).EndInit();
            this.groupBox1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.xtraTabOption)).EndInit();
            this.xtraTabOption.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.imgClassic)).EndInit();
            this.tabAllOption.ResumeLayout(false);
            this.groupBox7.ResumeLayout(false);
            this.groupBox7.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.cheShowTimekeeper.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.cheShowSalary.Properties)).EndInit();
            this.groupBox5.ResumeLayout(false);
            this.groupBox5.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dtMonthDefault.Properties.CalendarTimeProperties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtMonthDefault.Properties)).EndInit();
            this.tabSendMail.ResumeLayout(false);
            this.groupBox6.ResumeLayout(false);
            this.groupBox6.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.calPort.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.cheEnableSSL.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtHost.Properties)).EndInit();
            this.groupBox2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.cheShowSendMail.Properties)).EndInit();
            this.tabReport.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.imgMetro)).EndInit();
            this.ResumeLayout(false);

        }

        private static string LoadStyle()
        {
            DataSet set = new DataSet();
            set.ReadXml(Application.StartupPath + @"\Layout\Theme.xml");
            return set.Tables[0].Rows[0][1].ToString();
        }

        public void SetStyle(string Style)
        {
            if (Style == "Classic")
            {
                this.xtraTabOption.Images = this.imgClassic;
            }
            else
            {
                this.xtraTabOption.Images = this.imgMetro;
            }
        }

        private void xtraTabOption_SelectedPageChanged(object sender, TabPageChangedEventArgs e)
        {
            if ((e.Page != this.tabAllOption) && (e.Page != this.tabSendMail))
            {
                if (e.Page == this.tabContract)
                {
                    if (this.xucContractOption == null)
                    {
                        this.xucContractOption = new HRM.CORE.Option.xucContractOption();
                        this.xucContractOption.Dock = DockStyle.Fill;
                        this.tabContract.Controls.Add(this.xucContractOption);
                    }
                }
                else if (e.Page == this.tabTimeKeeper)
                {
                    if (this.xucTimeKeeperOption == null)
                    {
                        this.xucTimeKeeperOption = new HRM.CORE.Option.xucTimeKeeperOption();
                        this.xucTimeKeeperOption.Dock = DockStyle.Fill;
                        this.tabTimeKeeper.Controls.Add(this.xucTimeKeeperOption);
                    }
                }
                else if (e.Page == this.tabDocumentNumber)
                {
                    if (this.xucDocumentNumberOption == null)
                    {
                        this.xucDocumentNumberOption = new HRM.CORE.Option.xucDocumentNumberOption();
                        this.xucDocumentNumberOption.Dock = DockStyle.Fill;
                        this.tabDocumentNumber.Controls.Add(this.xucDocumentNumberOption);
                    }
                }
                else if (e.Page == this.tabMinimumSalary)
                {
                    if (this.xucMinimumSalary == null)
                    {
                        this.xucMinimumSalary = new HRM.CORE.xucMinimumSalary();
                        this.xucMinimumSalary.Dock = DockStyle.Fill;
                        this.tabMinimumSalary.Controls.Add(this.xucMinimumSalary);
                    }
                }
                else if (e.Page == this.tabSalary)
                {
                    if (this.xucSalaryFormula == null)
                    {
                        this.xucSalaryFormula = new HRM.CORE.xucSalaryFormula();
                        this.xucSalaryFormula.Dock = DockStyle.Fill;
                        this.tabSalary.Controls.Add(this.xucSalaryFormula);
                    }
                }
                else if (e.Page == this.tabReport)
                {
                    if (!this.m_LoadReportOption)
                    {
                        this.m_LoadReportOption = true;
                        this.xucHeaderReportOption1.LoadOption();
                        this.xucFooterReportOption1.LoadOption();
                    }
                }
                else if ((e.Page == this.tabWarning) && (this.xucWarningOption == null))
                {
                    this.xucWarningOption = new HRM.CORE.Option.xucWarningOption();
                    this.xucWarningOption.Dock = DockStyle.Fill;
                    this.tabWarning.Controls.Add(this.xucWarningOption);
                }
            }
        }
    }
}

